<template>
  <div class="page">
    <div class="title">考勤动态</div>
    <div style="margin-left:2rem;height:75%">
      <vue-seamless-scroll v-if="List.length>=4" :data="List" class="seamless-warp" :class-option="classOption">
        <ul>
          <li
            v-for="(item, index) in List"
            :key="index"
            class="flexStart"
            style="align-items:center"
          >
            <div
              style="width:5.3rem;border-radius:5.3rem;height:5.3rem;margin-right:2.6rem;margin-left:3rem;overflow:hidden"
            >
              <img :src="item.faceUrl" alt width="100%" height="100%" />
            </div>
            <div>
              <div style="color:#fff;font-size:1.4rem;margin-bottom:1.5rem">
                <span style="font-size:1.4rem">{{item.fullName}}</span>
                <span style="font-size:1.2rem;margin-right:5.4rem">（{{item.postName}}）</span>
                <span style="margin-right:5.4rem">{{item.teamName}}</span>
                <span>{{item.tenderCode}}</span>
              </div>
              <div>
                <span>{{item.recordDate}} {{item.recordTime}}</span>
              </div>
            </div>
          </li>
        </ul>
      </vue-seamless-scroll>
     
        <ul v-else>
          <li
            v-for="(item, index) in List"
            :key="index"
            class="flexStart"
            style="align-items:center"
          >
            <div
              style="width:5.3rem;border-radius:5.3rem;height:5.3rem;margin-right:2.6rem;margin-left:3rem;overflow:hidden"
            >
              <img :src="item.faceUrl" alt width="100%" height="100%" />
            </div>
            <div>
              <div style="color:#fff;font-size:1.4rem;margin-bottom:1.5rem">
                <span style="font-size:1.4rem">{{item.fullName}}</span>
                <span style="font-size:1.2rem;margin-right:5.4rem">（{{item.postName}}）</span>
                <span style="margin-right:5.4rem">{{item.teamName}}</span>
                <span>{{item.tenderCode}}</span>
              </div>
              <div>
                <span>{{item.recordDate}} {{item.recordTime}}</span>
              </div>
            </div>
          </li>
        </ul>
   
    </div>
  </div>
</template>

<script>
import vueSeamlessScroll from 'vue-seamless-scroll'
import { getAttendanceNews } from '@/api/dataCenterHome'
import { mapGetters } from 'vuex'
export default {
  data() {
    return {
      List: [],
      classOption: {
        step: 0.2, // 数值越大速度滚动越快
        limitMoveNum: 2, // 开始无缝滚动的数据量 this.dataList.length
        hoverStop: true, // 是否开启鼠标悬停stop
        direction: 1, // 0向下 1向上 2向左 3向右
        openWatch: true, // 开启数据实时监控刷新dom
        singleHeight: 0, // 单步运动停止的高度(默认值0是无缝不停止的滚动) direction => 0/1
        singleWidth: 0, // 单步运动停止的宽度(默认值0是无缝不停止的滚动) direction => 2/3
        waitTime: 1000 // 单步运动停止的时间(默认值1000ms)
        //  openRoll:false,
        // fheight:300,
      },
      timerDemicAttendance:null
    }
  },

  computed: {
    ...mapGetters(['userInfo'])
  },
  components: {
    //组件
    vueSeamlessScroll
  },
  mounted() {
    this.getAttendance()
    this.timerDemicAttendance = setInterval(() => {
       this.getAttendance()
    }, 300000)
  },
 
  beforeDestroy() {
    clearInterval(this.timerDemicAttendance)
  },
  
  methods: {
    //获取考勤动态数据
    getAttendance() {
      getAttendanceNews({ projectId: this.userInfo.projectId }).then((res) => {
        let resData=res.data.data
        this.List=resData
      })
    }
  }
}
</script>

<style scoped>
.page {
  width: 100%;
  height: 100%;
}
.title {
  font-size: 1.6rem;
  padding: 1.6rem 0 0 1.5rem;
  color: #fff;
  margin-bottom: 3%;
}
ul,
li {
  margin: 0;
  padding: 0;
  list-style: none;
  color: #5cffff;
}
li {
  cursor: pointer;
  height: 8rem;
  margin-bottom: 1.6rem;
  padding: 0.3rem;
  background: rgba(92, 255, 255, 0.2);

  border-radius: 1rem;
}
li:hover {
  color: #fff;
  border: 0.1rem solid #5cffff;
  transition: 0.5s all;
}
.seamless-warp {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-size: 1.4rem;
  font-family: 'Microsoft YaHei';
  font-weight: 400;
  color: #5cffff;
}
/* span {
  margin-right: 1rem;
} */
</style>